﻿using MediaBrowserSL.BLL;
using MediaBrowserSL.DAL;
using MediaBrowserSL.IBLL;
using MediaBrowserSL.IDAL;
using Microsoft.Practices.Unity;

namespace MediaBrowserSL.Services
{
    /// <summary>
    /// Locate Layers 
    /// </summary>
    public class LocatorLayers
    {
        private IUnityContainer container;

        public LocatorLayers()
        {
            container = new UnityContainer();

            container.RegisterType<IMediaRepository, SqlMediaRepository>()
                    .RegisterType<IMediaManager, MediaManager>();

            container.RegisterType<IUserRepository, SqlUserRepository>()
                    .RegisterType<IAuthenticationManager, AuthenticationManager>();
        }

        public IMediaManager MediaManager
        {
            get
            {
                return container.Resolve<IMediaManager>();
            }
        }

        public IAuthenticationManager AuthenticationManager
        {
            get
            {
                return container.Resolve<IAuthenticationManager>();
            }
        }
    }
}